<template>
  <div class="box">
    <div style="width: 200px;">
      <el-input @input="handleInput" v-model="content" v-if="showSearch" placeholder="请输入内容"></el-input>
    </div>
    <div>
      <el-button-group>
        <el-button type="primary" icon="el-icon-document-add" v-if="showAdd" @click="add">添加</el-button>
        <el-button type="warning" icon="el-icon-back" v-if="showBack" @click="back">返回</el-button>
      </el-button-group>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      content: ''
    }
  },
  methods: {
    add() {
      this.$emit('add')
    },
    handleInput() {
      this.$emit('handleInput', this.content)
    },
    back() {
      this.$emit('back')
    }
  },
  props: {
    showAdd: {
      type: Boolean,
      default: true
    },
    showSearch: {
      type: Boolean,
      default: true
    },
    showBack: {
      type: Boolean,
      default: false
    }
  }
}
</script>

<style scoped lang="less">
.box {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
}
</style>
